Skip to content

6741 add data render logic#6856

Merged
kcondon merged 7 commits intodevelopfrom
6741-add-data-render-logic
May 4, 2020
Merged

6741 add data render logic#6856
kcondon merged 7 commits intodevelopfrom
6741-add-data-render-logic

Conversation

@sekmiller
Copy link
Copy Markdown
Contributor

@sekmiller sekmiller commented Apr 24, 2020

What this PR does / why we need it:
This modifies the rendering of the Add Data buttonsin the header The Add Data button in the header has been changed so that whether or not the user is not logged in it will be rendered based on the permissions of a generic authenticated user in the Root Dataverse.
Functionality of the Add Data button in the body of the Dataverse Page is unchanged (and based on the respective permissions of the Dataverse being viewed.)

Which issue(s) this PR closes:

Closes #6741

Special notes for your reviewer:
I am making use of ui:params to isolate the render logic

Suggestions on how to test this:

Does this PR introduce a user interface change?:
no
Is there a release notes update needed for this change?:
no
Additional documentation:
none

Copy link
Copy Markdown
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Comment thread src/main/webapp/dataverse_header.xhtml Outdated
Comment on lines +215 to +217
function a () {
var contact = prompt("Add the contact.");
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this code just for debugging?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I have removed it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops. Sorry. I didn't mean to include that in my review. I saw you had already deleted it. I forgot to go back and delete the comment.

Copy link
Copy Markdown
Contributor

@mheppler mheppler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments regarding suggested optimization as well as a question about potential broken functionality on pgs that aren't the dataverse pg.

Comment thread src/main/webapp/dataverse_header.xhtml Outdated
<h:outputLink value="/dataset.xhtml?ownerId=#{dataverseServiceBean.findRootDataverse().id}">
<h:outputText value="#{bundle['dataverse.results.btn.addData.newDataset']}"/>
</h:outputLink>
<ui:fragment rendered="#{showAddDataGroup}">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The render logic in these duplicate ui:fragment components should consolidated and moved directly into the li components like other navbar features on this page <li jsf:rendered="#{...}"> (line 88).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as requested I removed the ui:fragments and moved the render logic to jsf:rendered.

Comment thread src/main/webapp/dataverse_header.xhtml Outdated
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">#{bundle['dataverse.results.btn.addData']} <b class="caret"></b></a>
<ul class="dropdown-menu">
<ui:fragment rendered="#{showAddDataverseLink}">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same render logic moved into the li here as suggested above.

Comment thread src/main/webapp/dataverse_header.xhtml Outdated
<ui:fragment rendered="#{showAddDataGroup}">
<ui:fragment rendered="#{!authUserSession}">
<li>
<a href="#" onClick="PF('addData_popup').show()">#{bundle['dataverse.results.btn.addData']} </a>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addData_popup reference that was copied over from search-include-fragment will now look for that dialog on every page, but the dataverse pg is the only page that will have the dialog included on it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the add data popup into a fragment and included it in the dataverse template.

@mheppler mheppler assigned mheppler and unassigned sekmiller Apr 27, 2020
</f:facet>
</p:ajaxStatus>
<ui:include src="contactFormFragment.xhtml"></ui:include>
<ui:include src="addDataFormFragment.xhtml"></ui:include>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering what the best way to handle this popup is, and I think this a great solution. 👍

Copy link
Copy Markdown
Contributor

@mheppler mheppler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good. 👍

@mheppler mheppler removed their assignment Apr 27, 2020
@scolapasta scolapasta assigned scolapasta and sekmiller and unassigned scolapasta Apr 27, 2020
-if the user is not logged in when pressing button
@sekmiller sekmiller assigned scolapasta and unassigned sekmiller Apr 28, 2020
@scolapasta scolapasta removed their assignment Apr 28, 2020
@kcondon kcondon self-assigned this May 4, 2020
@kcondon kcondon merged commit f030763 into develop May 4, 2020
@kcondon kcondon deleted the 6741-add-data-render-logic branch May 4, 2020 18:14
@djbrooke djbrooke added this to the Dataverse 5 milestone May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rendering of the "Add Data" button in the header should be based on permissions of generic authenticated user in Root

6 participants